import typer
import asyncio
from scripts.initialize.initialize import InitializeData

"""
FastApi 更新文档：https://github.com/tiangolo/fastapi/releases
FastApi Github：https://github.com/tiangolo/fastapi
Typer 官方文档：https://typer.tiangolo.com/
"""

shell_app = typer.Typer()

@shell_app.command()
def migrate():
    """
    将模型迁移到数据库，更新数据库表结构
    """
    print("开始更新数据库表")
    InitializeData.migrate_model()

@shell_app.command()
def init():
    """
    初始化数据
    """
    print("开始初始化数据")
    data = InitializeData()
    asyncio.run(data.run())

if __name__ == '__main__':
    shell_app()
